<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>配送单打印</title>
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
<style type="text/css">
.bar {
	height: 30px;
	line-height: 30px;
	border-bottom: 1px solid #d7e8f8;
	background-color: #eff7ff;
}

table {
	width: 100%;
}

table th {
	font-weight: bold;
	text-align: left;
}

table td, table th {
	line-height: 30px;
	padding: 0px 4px;
	font-size: 10pt;
	color: #000000;
}
.separated th, .separated td {
	border-top: 1px solid #000000;
	border-bottom: 1px solid #000000;
}
</style>
<style type="text/css" media="print">
.bar {
	display: none;
}
</style>
<script type="text/javascript">
$().ready(function() {

	var $print = $("#print");

	$print.click(function() {
		window.print();
		return false;
	});

});
</script>
</head>
<body>
	<div class="bar">
		<a href="javascript:;" id="print" class="button">打印</a>
	</div>
	<div class="content">
		<table>
			<tr>
				<td colspan="2" rowspan="2">
				</td>
				<td>
					上海美嘉饲料有限公司
				</td>
				<td>
					&nbsp;
				</td>
				<td colspan="2">
					收货人: ${order.consignee}
				</td>
			</tr>
			<tr>
				<td>
					<%=basePath%>
				</td>
				<td>
					&nbsp;
				</td>
				<td colspan="2">
					会员名: ${order.member.username}
				</td>
			</tr>
			<tr class="separated">
				<th colspan="2">
					订单编号: ${order.sn}
				</th>
				<th colspan="2">
					创建日期: <fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</th>
				<th colspan="2">
					<jsp:useBean id="now" class="java.util.Date" />
					打印日期: <fmt:formatDate value="${now}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</th>
			</tr>
			<tr>
				<td colspan="6">
					&nbsp;
				</td>
			</tr>
			<tr class="separated">
				<th>
					序号
				</th>
				<th>
					商品编号
				</th>
				<th>
					商品名称
				</th>
				<th>
					价格
				</th>
				<th>
					数量
				</th>
				<th>
					小计
				</th>
			</tr>
			<c:forEach items="${order.orderItems}" var="orderItem" varStatus="status">
				<tr>
					<td>
						${status.index+1}
					</td>
					<td>
						${orderItem.sn}
					</td>
					<td>
						${orderItem.fullName}
					</td>
					<td>
						<fmt:formatNumber value="${orderItem.price}" pattern="0.00"/>
					</td>
					<td>
						<fmt:formatNumber value="${orderItem.quantity}" pattern="0.00"/>
					</td>
					<td>
						<fmt:formatNumber value="${orderItem.subtotal}" pattern="0.00"/>
					</td>
				</tr>
			</c:forEach>
			<tr>
				<td colspan="6">
					&nbsp;
				</td>
			</tr>
			<tr class="separated">
				<td colspan="3">
					&nbsp;
				</td>
				<td colspan="3">
					收货人: ${order.consignee}<br />
					地址: ${order.areaName}${order.address}<br />
					邮编: ${order.zipCode}<br />
					电话: ${order.phone}<br />
					配送方式: ${order.shippingMethodName}
				</td>
			</tr>
			<tr>
				<td>
					&nbsp;
				</td>
				<td>
					&nbsp;
				</td>
				<td>
					&nbsp;
				</td>
				<td>
					&nbsp;
				</td>
				<td colspan="2">
					Powered By 上海美嘉饲料有限公司
				</td>
			</tr>
		</table>
	</div>
</body>
</html>